use "Bush Prather Who's There Manuscript.dta", clear


****TABLE 1****

*Model 1
ologit cred2 any_eos preswin2 age sex employed polint polknowledge, robust

*Model 2
ologit cred2 i.treat_eos preswin2 age sex employed polint polknowledge, robust

*Model 3
logit cap2 i.treat_eos preswin2 age sex employed polint polknowledge, robust

*Model 4
logit bias2 i.treat_eos preswin2 age sex employed polint polknowledge, robust

*Model 5
ologit joint i.treat_eos preswin2 age sex employed polint polknowledge, robust


****TABLE 2****

*Models 1, 3, 4 
*install mediation package using command "ssc install mediation"
set more off
#delimit ;
medeff (regress joint treat_araball preswin2 age sex employed polint polknowledge)
(regress cred2 joint treat_araball preswin2 age sex employed polint polknowledge),
mediate(joint) treat(treat_araball) sims(1500) seed(5) vce(robust);
#delimit cr;


*Model 2
regress cred2 treat_araball preswin2 age sex employed polint polknowledge if joint~=.

****FIGURE 1****
*see further R code for figure
tab will2 trust2 if treat_eos==1, cell

****FIGURE 2****
ologit cred2 i.treat_eos preswin2 age sex employed polint polknowledge, robust
margins treat_eos, predict(outcome(2)) asbalanced
marginsplot, x(treat_eos) plot1opts(mcolor(black) lcolor(black) ///
	connect(no)) ci1opts(recast(rspike) lcolor(black)) ///
	graphregion(fcolor(white) lcolor(white)) plotregion(fcolor(white) ///
	lstyle(none) lcolor(white) ilstyle(none)) title("", color(black)) ///
	ytitle("Probability that Credibility = 2", size(medsmall)) ///
	ylabel(0.65(.05).85, labsize(small) glcolor(gs14) angle(horizontal)) ///
	xlabel(,valuelabel labsize(medium) glcolor(white) angle(horizontal)) ///
	xscale(range(0.7 6.3)) yscale(range(0.62 .87)) xtitle("") ///
	note("Note: 95% CI Reported", size(vsmall))
	
****FIGURE 3****
logit cap2 i.treat_eos preswin2 age sex employed polint polknowledge, robust
margins treat_eos, asbalanced
marginsplot, x(treat_eos) plot1opts(mcolor(black) lcolor(black) ///
	connect(no)) ci1opts(recast(rspike) lcolor(black)) ///
	graphregion(fcolor(white) lcolor(white)) plotregion(fcolor(white) ///
	lstyle(none) lcolor(white) ilstyle(none)) title("", color(black)) ///
	ytitle("Probability that Capability = 1", size(medsmall)) ///
	ylabel(0.6(.1)1, labsize(small) glcolor(gs14) angle(horizontal)) ///
	xlabel(,valuelabel labsize(medium) glcolor(white) angle(horizontal)) ///
	xscale(range(1.5 6.5)) yscale(range(0.58 1.02)) xtitle("") ///
	note("Note: 95% CI Reported", size(vsmall))
	
****FIGURE 4****
logit bias2 i.treat_eos preswin2 age sex employed polint polknowledge, robust
margins treat_eos, asbalanced
marginsplot, x(treat_eos) plot1opts(mcolor(black) lcolor(black) ///
	connect(no)) ci1opts(recast(rspike) lcolor(black)) ///
	graphregion(fcolor(white) lcolor(white)) plotregion(fcolor(white) ///
	lstyle(none) lcolor(white) ilstyle(none)) title("", color(black)) ///
	ytitle("Probability that Bias = 1", size(medsmall)) ///
	ylabel(0(.1).4, labsize(small) glcolor(gs14) angle(horizontal)) ///
	xlabel(,valuelabel labsize(medium) glcolor(white) angle(horizontal)) ///
	xscale(range(1.5 6.5)) yscale(range(0 .42)) xtitle("") ///
	note("Note: 95% CI Reported", size(vsmall))

****FIGURE 5****
ologit joint i.treat_eos preswin2 age sex employed polint polknowledge, robust
margins treat_eos, predict(outcome(2)) asbalanced
marginsplot, x(treat_eos) plot1opts(mcolor(black) lcolor(black) ///
	connect(no)) ci1opts(recast(rspike) lcolor(black)) ///
	graphregion(fcolor(white) lcolor(white)) plotregion(fcolor(white) ///
	lstyle(none) lcolor(white) ilstyle(none)) title("", color(black)) ///
	ytitle("Probability Monitors Viewed as Capable & Unbiased", size(medsmall)) ///
	ylabel(0.4(.1).8, labsize(small) glcolor(gs14) angle(horizontal)) ///
	xlabel(,valuelabel labsize(medium) glcolor(white) angle(horizontal)) ///
	xscale(range(1.5 6.5)) yscale(range(.4 .82)) xtitle("") ///
	note("Note: 95% CI Reported", size(vsmall))
	
